<?php
/**
 * Created by PhpStorm.
 * User: cy
 * Date: 18-3-3
 * Time: 下午10:03
 */
include '../Include/db.php';
$goodsId=10;
$redisKey='seckill_list_'.$goodsId;
$db=DB::getIntance();
$redis=new Redis();
$redis->connect('127.0.0.1',6379);
while (true){
    $data=$redis->rPop($redisKey);
    if(!$data){
        continue;
    }
    $dataArr=explode('|',$data);
    $res=$db->insert('redis_queue',['uid'=>$dataArr[0],'created_at'=>$dataArr[2],'goods_id'=>$dataArr[1]]);
    if(!$res){
        $redis->rPush($redisKey,$data);
    }
}